<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<script src="../js/angular.min.js"></script>
	<title>Title</title>
</head>
<body>
	<div ng-app="myApp" ng-controller="personCtrl">
		
		名: <input type="text" ng-model="firstName"><br>
		姓: <input type="text" ng-model="lastName"><br>
		<br>
		<!-- 表达式内调用作用域函数personCtrl -->
		姓名: {{fullName()}}
	</div>
</body>
<script>
	// 1、创建模块app
    var app = angular.module('myApp', []);
    // 2、创建控制器personCtrl
    app.controller('personCtrl', function($scope) {
        // 2.1 创建作用域变量
        $scope.firstName = "John";
        $scope.lastName = "Doe";
        // 2.2 创建作用域函数，返回两个字符串的拼接
        $scope.fullName = function() {
            return $scope.firstName + " " + $scope.lastName;
        }
    });
</script>
</html>